# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=ukui-settings-daemon
pkgver=3.1.1.1
pkgrel=3
pkgdesc="Daemon handling the UKUI session settings"
arch=('loong64' 'x86_64')
license=('GPL')
url="https://github.com/ukui/ukui-settings-daemon"
groups=('ukui')
depends=('geoclue' 'gnome-desktop' 'gsettings-qt' 'gtk3' 'kconfig' 'kglobalaccel' 'kwindowsystem'
         'imlib2' 'libcanberra' 'libkscreen' 'libmatekbd' 'libmatemixer' 'libnotify' 'libxklavier'
         'mate-desktop' 'qt5-sensors' 'qt5-svg' 'qt5-x11extras' 'ukui-interface')
makedepends=('qt5-tools' 'xorg-server-devel')
source=("$pkgname-$pkgver.tar.gz::https://github.com/ukui/ukui-settings-daemon/archive/v$pkgver.tar.gz"
         libkscreen-5.27.patch)
sha512sums=('451cca8c153764c497d502eb6159db44bbdf0fce63c5ee38d3f347ee8c1d84d726f7026b1b02b463c6c7a8b9a15a84ad5df8f27b5afe0e06d2b6a81481839fe4'
            'e99ae6572322d727b67cafe83559c98dc0f93e29a2c982ab9b34a74c6bf9afa241aa8fdf90ed5b04b464c46d08ef90ecabbe99fcb93e2e8ce711db59597183cc')

prepare() {
  cd $pkgname-$pkgver
  sed -i 's|#include <ukuisdk/kylin-com4cxx.h>|#include <kylin-com4cxx.h>|' common/usd_base_class.h
  sed -i 's|udev.path = /lib/udev/rules.d/|udev.path = /usr/lib/udev/rules.d/|' plugins/mouse/mouse.pro

  # Fix build with libkscreen 5.27
  sed -e 's|c++11||' -i plugins/xrandr/xrandr.pro -i common/common.pri
  patch -p1 -i ../libkscreen-5.27.patch
}

build() {
  cd $pkgname-$pkgver
  qmake-qt5 PREFIX=/usr
  make
}

package() {
  cd $pkgname-$pkgver
  make INSTALL_ROOT="$pkgdir" install
}
